﻿<!DOCTYPE >
<html>
<head>
    <title>微街秀 > 费用充值</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <link rel="stylesheet" type="text/css" href="css/css.css">
    <link rel="stylesheet" type="text/css" href="css/MakeCost.css">
    <script src="js/ajax-data.js" type="text/javascript"></script>
    <script src="js/jquery-2.1.4.min.js" type="text/javascript"></script>
    <script src="js/base.js" type="text/javascript"></script>
    <script src="js/dialog.js" type="text/javascript"></script>
</head>
<body>
    <div>
        <div class="wamtop">
            <div class="topleft" onclick="window.location.href='MakeFt.html'">
                <img src="img/5.jpg" /></div>
            <div class="topcententxt">
                费用充值</div>
            <div class="topright tixian" style="color: white;">
                提现</div>
        </div>
        <div class="tg_top">
            <div class="toptxt" style="margin-top: 10px;">
                <img src="img/Makeimg/12.png" style="width: 50px;" /></div>
            <div class="toptxt">
                账号余额：<br />
                <span class="ad_balance" style="color: Red;">0.00</span>
            </div>
            <div class="rightPay">
                <a href="MakeRecharge.html">充值</a>
            </div>
        </div>
        <div class="tg_tag">
            <div class="pay tag selecttag">
                充值记录</div>
            <div class="fee tag">
                扣费记录</div>
        </div>
        <section class="tg_pay">            
        </section>
        <section class="tg_fee" style="display: none">             
        </section>
    </div>
</body>
<script>
    var pagecount = "0";
    var page = 1;
    var keyword = "1";


    $(document).ready(function () {
        bindTabClick();
        LoadBalance();
        load(page);
        $(window).bind("scroll", function () {
            //当滚动条滚动时
            var scollTop = $(this).scrollTop() + $(this).height();
            var scollH = $(document).height();
            if (scollH - scollTop < 100) {
                if (wait.isShow) { return; } //如果正在加载，则返回
                page++;
                load(page);
            }
            return false;
        });
    });

    function bindTabClick() {
        $(".tag").click(function () {
            if ($(this).css("background").toString().indexOf("254") > 0) return;
            $(this).siblings().removeClass("selecttag");
            $(this).addClass("selecttag");
            var section = $("section");
            if (section.eq(0).css("display") == "block") {
                section.eq(0).css("display", "none");
                section.eq(1).css("display", "block");
                keyword = "2";
                $(".tg_fee").html("");
            }
            else {
                section.eq(0).css("display", "block");
                section.eq(1).css("display", "none");
                keyword = "1";
                $(".tg_pay").html("");
            }
            page = 1;
            pagecount = "0";
            load(page);
        });
    }

    function LoadBalance() {
        AjaxStart("ajax/user.ashx?getbalance", "&type=1", function (data) {
            if (data.code == 0)
                $(".ad_balance").html(parseFloat(data.item).toFixed(2));
            $(".tixian").bind("click", TX)
        });
    }
    function load(page) {
        if (pagecount == "1") {
            return;
        }
        if (!islogin()) {
            window.location.href = 'login.html'; return;
        }
        AjaxStart("ajax/fc_record.ashx?getlist", "&direction=" + keyword + "&page_index=" + page, function (data) {
            if (data.code == "4") {
                Alert(data.msg.toString()); pagecount = "1";
                return;
            }

            if (data.item.pageCount < page) {
                if (pagecount == "0") {
                    Alert('到底了！');
                }
                pagecount = "1";
                return;
            }
            loadhtml(data);
        });
    }

    function loadhtml(data) {
        $(data.item.table).each(function () {
            if (keyword == "1") {
                $(".tg_pay").append("<div onclick=\"window.location.href='makepayDetail.html?id=" + this.id + "'\">" +
               "<div class=\"paydetail\">" + this.date.replace("T", " ").substring(0, 19) + "</div>" +
               "<div class=\"paydetail\"><span>+" + this.amount + "</span> <br />充值金额</div>" +
               "<div class=\"paydetail\"><span>￥" + this.balance + "</span><br />余额</div></div>");
            }
            else {
                var title = this.articleid > 0 ? this.title : "余额提现";
                if (title != null && title.length > 12)
                    title = title.substr(0, 12) + "...";
                $(".tg_fee").append("<div onclick=\"window.location.href='makefeeDetail.html?id=" + this.id + "'\">" +
               "<div class=\"feedetail\">" + this.date.replace("T", " ").substring(0, 19) + "</div>" +
               "<div class=\"feedetail\">" + title + "</div>" +
               "<div class=\"feedetail\"><span>￥" + this.amount + "</span><br />金额</div></div>");
            }
        });
    }

    function TX() {
        //window.location.href = 'makezfbdrop.html?platform=1&type=1&balance=' + $(".ad_balance").html();
        window.location.href = 'makezfbdrop.html?platform=2&type=1&balance=' + $(".ad_balance").html();
    }
</script>
</html>
